<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html><html lang="en">
	<head>
		<!--加载header文件-->
		<?php
		include_once 'public/views/header.php';
		?>
	
		<link rel="stylesheet" href="public/css/list.css" />
		<link rel="stylesheet" href="public/xr/xrDatatable.css" />
		<script src="public/assets/js/jquery-2.0.3.min.js"></script>
		<script src="public/xr/xrDatatable.js"></script>
		<script src="public/home/js/function.js"></script>

		<style>
			.page-container  {
				padding: 20px 12% 0 12%;
			}
		</style>
	</head>
	<body>
	<!-- 	<div class="page-container container">
			<h1>系统已关闭</h1>
			<input type="hidden"  id="is_close" value="<?=$is_close?>" />
			<button class="pageItemButton" id="save"  onclick="exportData();">
				<i class="icon-remove" style="display: none;"></i>
				<i class="icon-ok"  style="display: none;"></i>	
				<?=$title?>
			</button>

		</div> -->

		<div class="page-container container">

			<div class="operationRow">
				<input type="hidden"  id="is_close" value="<?=$is_close?>" />
				<button class="pageItemButton" id="save"  onclick="exportData();">
					<i class="icon-remove" style="display: none;"></i>
					<i class="icon-ok"  style="display: none;"></i>	
					<?=$title?>
				</button>
				<span><?=$caption?></span>
			</div>
		
		</div>
	</body>
	<script type="text/javascript">
		$(function(){
			if($("#is_close").val()=='1'){ //已关闭
				$(".icon-ok").show();
				$(".icon-remove").hide();
			}else{							
				$(".icon-ok").hide();
				$(".icon-remove").show();
			}		

		})

		//打开或者关闭系统
		function exportData(){
			var is_close = $("#is_close").val();
			if(is_close == '1'){
			   var msg = "确认打开系统?";
			}else{
			   var msg = "确认关闭系统?";
			}
		
			swal({
				title: "请确认",
				text: msg,
				type: "warning",
				showCancelButton: true,
				closeOnConfirm: true,
				confirmButtonText: "确定",
				cancelButtonText: '取消',
				confirmButtonColor: "#ec6c62"
			}, function(isConfirm) {
				if(isConfirm) {
					$.ajax({
						type: "post",
						url: "Admin/Config/save/"+is_close,
						async: true,
						success: function(data) {
							var ret = $.parseJSON(data);
							if(ret.status) {
								window.parent.topMessagePrompt('success',ret.msg);
			                    window.parent.refreshTable();
								window.location.reload();
							} else {
								window.parent.topMessagePrompt('error',ret.msg);
							}
						}
					});
				}
			});

		}

	</script>
</html>